import fw from '../framework.js'
function publishTerminal(terminalIds,channelId,success,error){
    var publishAjaxData = {
        "channelId": channelId,
        "terminals": terminalIds,
        "classifies": [],
        "tags": [],
        "publishTerminalType": 1,
        "isForce": true // 默认不校验横竖屏
    };
    fw.ajax('channelPublish/target/v2/publish', publishAjaxData).then(res => {
        if (res.code == 0) {
            success(res.data);
        } else {
            error(res);
        }
    });
}

function publishTag(tags,channelId,success,error){
    var publishAjaxData = {
        "channelId": channelId,
        "terminals": [],
        "classifies": [],
        "tags": tags,
        "publishTerminalType": 1,
        "isForce": true // 默认不校验横竖屏
    };
    fw.ajax('channelPublish/target/v2/publish', publishAjaxData).then(res => {
        if (res.code == 0) {
            success(res.data);
        } else {
            error(res);
        }
    });
}

module.exports = {
    publishTerminal:publishTerminal,
    publishTag:publishTag
}